import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { usePermission } from "/@/hooks/web/usePermission";
const { hasPermission } = usePermission();

//列表数据
export const columns: BasicColumn[] = [
  {
    title: '任务名称',
    align: "center",
    dataIndex: 'settleName'
  },
  {
    title: '成功数据',
    align: "center",
    dataIndex: 'successAmount',
    slots: { customRender: 'successSlot' },
  },
  {
    title: '任务结算单',
    align: "center",
    dataIndex: 'settleDoc',
    slots: { customRender: 'fileSlot' },
  },
  {
    title: '确认函',
    align: "center",
    dataIndex: 'confirmationLetterDoc',
    slots: { customRender: 'fileSlot' },
  },
  {
    title: '结算清单',
    align: "center",
    dataIndex: 'settleListDoc',
    slots: { customRender: 'fileSlot' },
  },
  // {
  //   title: '审核状态',
  //   align: "center",
  //   dataIndex: 'checkStatus',
  //   slots: { customRender: 'checkStatusSlot' },
  // },
  {
    title: '任务时间',
    align: "center",
    sorter: true,
    helpMessage: ['任务结算创建时间'],
    dataIndex: 'settleCreateTime'
  },
  {
    title: '创建时间',
    align: "center",
    sorter: true,
    dataIndex: 'createTime'
  },
];

export const columns1: BasicColumn[] = [
  {
    title: '上传时间',
    align: "center",
    sorter: true,
    dataIndex: 'uploadTime'
  },
];
export const columns2: BasicColumn[] = [
  {
    title: '审核时间',
    align: "center",
    sorter: true,
    dataIndex: 'checkTime',
  },
];
export const columns3: BasicColumn[] = [
  {
    title: '拒绝原因',
    align: "center",
    dataIndex: 'rejectReason',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建时间",
    field: "createTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "税源地ID",
    field: 'companyId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "caishui_service_company,name,id"
    },
    colProps: {span: 6},
  },
  {
    label: "商户ID",
    field: 'businessId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "caishui_business,name,id"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '结算清单',
    field: 'settleListDoc',
    component: 'JUpload',
    componentProps:{
      maxCount: 1
     },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入结算清单!'},
             ];
    },
  },
  {
    label: '确认函',
    field: 'confirmationLetterDoc',
    component: 'JUpload',
    componentProps:{
      maxCount: 1
     },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入确认函!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
